<div>
    <div class="row" style="padding: 0 20px 0;">
        <nodestr></nodestr>
    </div>

    <hr class="mv10 clear">

    <div class="panel panel-primary">

        <div class="panel-heading">
            <h5>基本信息</h5>
        </div>

        <div class="panel-body">

            <div class="form-horizontal">

                <form class="form-inline" name="searchForm" novalidate>
                    <div class="container-fluid">
                        <div class="row" style="padding: 5px;">
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">作业名称：</label>
                                <span style="font-size: 15px">{{taskname}}</span>
                            </div>
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">执行结果：</label>
                                <span style="font-size: 15px">{{historyjobdetail.statuszh[status]}}</span>
                                <i ng-if="status != 'success' && status != 'fail' && status != 'refuse'" class="fa fa-refresh fa-fw" ng-class="{'fa-spin':1}"></i>
                                <button ng-if="status == 'running' || status == 'waiting'" class="btn btn-danger btn-sm" ng-click="historyjobdetail.killTask()" style="border-radius: 10%;padding: 1px 10px;">终止任务 </button>
                            </div>
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">启动人：</label>
                                <span style="font-size: 15px">{{runuser}}</span>
                            </div>
                        </div>
                        <div class="row" style="padding: 5px;">
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">开始时间：</label>
                                <span style="font-size: 15px">{{starttime}}</span>
                            </div>
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">结束时间：</label>
                                <span style="font-size: 15px">{{finishtime}}</span>
                            </div>
                            <div class="form-group col-sm-4" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">耗时：</label>
                                <span style="font-size: 15px">{{historyjobdetail.seftime(starttime,finishtime)}}</span>
                            </div>
                        </div>
                        <div ng-show="historyjobdetail.taskuuid" class="row" style="padding: 5px;">
                            <div class="form-group" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">任务日志：</label>
                                <button class="btn btn-primary btn-sm" ng-click="historyjobdetail.taskLogDetail()">执行详情</button>
                                <span ng-show="errreason" style="color: red;margin-left: 10px">错误: &nbsp; {{errreason}}</span>
                            </div>
                        </div>
                        <div ng-if="variable" ng-show="historyjobdetail.taskuuid" class="row" style="padding: 5px;">
                            <div class="form-group" style="padding: 0">
                                <label style="line-height: 34px;min-width: 90px;text-align: right;">调用变量：</label>
                                <span style="font-size: 15px">{{variable}}</span>
                            </div>
                        </div>
                    </div>
                </form>

            </div>

        </div>
    </div>

    <div class="panel panel-dark">

        <div class="panel-heading">

            <span class="panel-controls">
                <button class="btn btn-dark" uib-tooltip="刷新" ng-click="historyjobdetail.reload()" ><i class="fa fa-refresh fa-fw" ng-class="{'fa-spin':!historyjobdetail.loadover}" ></i></button>
            </span>
            <h5>作业步骤 </h5>
        </div>

        <div class="panel-body">
            <div ng-repeat="item in historyjobdetail.allRuningData">
                <div ng-if="item.subtask_type == 'cmd'" class="panel panel-success">
                    <div class="panel-heading" style="height: 33px">
                        <h5>脚本作业</h5>
                    </div>
                    <div class="panel-body" style="padding: 10px">
                        <div class="panel-tabs">
                            <table class="table table-hover text-center table-condensed" style="margin-bottom: 0">
                                <thead>
                                <tr>
                                    <th style="text-align: center;">作业名称</th>
                                    <th style="text-align: center;">执行主机数</th>
                                    <th style="text-align: center;">开始时间</th>
                                    <th style="text-align: center;">结束时间</th>
                                    <th style="text-align: center;">耗时</th>
                                    <th style="text-align: center;">状态</th>
                                    <th style="text-align: center;">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                    <tr ng-click="historyjobdetail.HideMsg($index)" style="cursor: pointer">
                                        <td>{{item.extended.name}}</td>
                                        <td>{{item.nodecount}}</td>
                                        <td>{{item.starttime}}</td>
                                        <td>{{item.finishtime}}</td>
                                        <td>{{historyjobdetail.seftime(item.starttime,item.finishtime)}}</td>
                                        <td ng-style="setStatuColor(item.status)">{{historyjobdetail.statuszh[item.status]}}</td>
                                        <td ng-if="item.status == 'success'">
                                            <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                            <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                        </td>
                                        <td ng-if="item.status=='decision'">
                                            <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                            <button class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.Runnigs($index, item)">重试</button>
                                            <button class="btn btn-danger btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runIgnore($index, item)">忽略错误</button>
                                            <button class="btn btn-dark btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runShutTask($index, item)">终止任务 </button>

                                        </td>
                                        <td ng-if="item.status=='ignore'">
                                            <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                            <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>

                                        </td>
                                        <td ng-if="item.status=='running'">
                                            <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        </td>
                                        <td ng-if="item.status=='fail'">
                                            <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                            <button ng-if="item.pause" class="btn btn-success btn-sm" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                        </td>
                                        <td ng-if="!item.status"> </td>
                                    </tr>
                                </tbody>

                            </table>
                            <div ng-if="historyjobdetail.show[$index]" style="border-top: 1px solid #ddd;">
                                <div class="form-horizontal">
                                    <form class="form-inline" name="searchForm" novalidate>
                                        <div class="container-fluid">
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">name:</label>
                                                    <span style="font-size: 15px">{{item.extended.name}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">node_type:</label>
                                                    <span style="font-size: 15px">{{item.extended.node_type}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">scripts_type:</label>
                                                    <span style="font-size: 15px">{{item.extended.scripts_type}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">user:</label>
                                                    <span style="font-size: 15px">{{item.extended.user}}</span>
                                                </div>
                                            </div>
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">timeout:</label>
                                                    <span style="font-size: 15px">{{item.extended.timeout}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">pause:</label>
                                                    <span style="font-size: 15px">{{item.extended.pause}}</span>
                                                </div>
                                            </div>
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group " style="display:block;word-break: break-all;word-wrap: break-word;">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">node_cont:</label>
                                                    <span style="font-size: 15px">{{item.extended.node_cont}}</span>
                                                </div>
                                            </div>
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group " style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">scripts_cont:</label>
                                                    <span style="font-size: 15px">{{item.extended.scripts_cont}}</span>
                                                </div>
                                            </div>
                                        </div>
                                    </form>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div ng-if="item.subtask_type == 'scp'" class="panel panel-primary">
                    <div class="panel-heading" style="height: 33px">
                        <h5>文件作业</h5>
                    </div>
                    <div class="panel-body"  style="padding: 10px">
                        <div class="panel-tabs">
                            <table class="table table-hover text-center table-condensed" style="margin-bottom: 0">
                                <thead>
                                    <tr>
                                        <th style="text-align: center;">作业名称</th>
                                        <th style="text-align: center;">执行主机数</th>
                                        <th style="text-align: center;">开始时间</th>
                                        <th style="text-align: center;">结束时间</th>
                                        <th style="text-align: center;">耗时</th>
                                        <th style="text-align: center;">状态</th>
                                        <th style="text-align: center;">操作</th>
                                    </tr>
                                </thead>
                                <!--<table class="table table-hover text-center table-condensed">-->
                                <tbody>
                                <tr ng-click="historyjobdetail.HideMsg($index)" style="cursor: pointer">
                                    <td >{{item.extended.name}}</td>
                                    <td >{{item.nodecount}}</td>
                                    <td >{{item.starttime}}</td>
                                    <td >{{item.finishtime}}</td>
                                    <td >{{historyjobdetail.seftime(item.starttime,item.finishtime)}}</td>
                                    <td ng-style="setStatuColor(item.status, 'scp')">{{historyjobdetail.statuszh[item.status]}}</td>
                                    <td ng-if="item.status == 'success'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='decision'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.Runnigs($index, item)">重试</button>
                                        <button class="btn btn-danger btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runIgnore($index, item)">忽略错误</button>
                                        <button class="btn btn-dark btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runShutTask($index, item)">终止任务</button>
                                    </td>
                                    <td ng-if="item.status=='fail'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="$index != historyjobdetail.tasklength  && status != 'fail'" class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">下一步</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='ignore'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='running'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                    </td>
                                    <td ng-if="!item.status"> </td>

                                </tr>
                                </tbody>
                            </table>
                            <div ng-if="historyjobdetail.show[$index]" style="border-top: 1px solid #ddd;">
                                <div class="form-horizontal">
                                    <form class="form-inline" name="searchForm" novalidate>
                                        <div class="container-fluid">
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">name:</label>
                                                    <span style="font-size: 15px">{{item.extended.name}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">user:</label>
                                                    <span style="font-size: 15px">{{item.extended.user}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">timeout:</label>
                                                    <span style="font-size: 15px">{{item.extended.timeout}}</span>
                                                </div>
                                                <div class="form-group col-sm-6" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">pause:</label>
                                                    <span style="font-size: 15px">{{item.extended.pause}}</span>
                                                </div>
                                            </div>
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">src:</label>
                                                    <span style="font-size: 15px">{{item.extended.src}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">sp:</label>
                                                    <span style="font-size: 15px">{{item.extended.sp}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">src_type:</label>
                                                    <span style="font-size: 15px">{{item.extended.src_type}}</span>
                                                </div>
                                            </div>

                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="col-sm-6" style="display:block;word-break: break-all;word-wrap: break-word;">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">dst:</label>
                                                    <span style="font-size: 15px">{{item.extended.dst}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">dp:</label>
                                                    <span style="font-size: 15px">{{item.extended.dp}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">dst_type:</label>
                                                    <span style="font-size: 15px">{{item.extended.dst_type}}</span>
                                                </div>
                                            </div>
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">chmod:</label>
                                                    <span style="font-size: 15px">{{item.extended.chmod}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">chown:</label>
                                                    <span style="font-size: 15px">{{item.extended.chown}}</span>
                                                </div>
                                            </div>

                                        </div>
                                    </form>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


                <div ng-if="item.subtask_type == 'approval'" class="panel panel-info">
                    <div class="panel-heading" style="height: 33px">
                        <h5>审批作业</h5>
                    </div>
                    <div class="panel-body"  style="padding: 10px">
                        <div class="panel-tabs">
                            <table class="table table-hover text-center table-condensed" style="margin-bottom: 0">
                                <thead>
                                    <tr>
                                        <th style="text-align: center;">作业名称</th>
                                        <th style="text-align: center;">审批人</th>
                                        <th style="text-align: center;">开始时间</th>
                                        <th style="text-align: center;">结束时间</th>
                                        <th style="text-align: center;">耗时</th>
                                        <th style="text-align: center;">状态</th>
                                        <th style="text-align: center;">操作</th>
                                    </tr>
                                </thead>
                                <!--<table class="table table-hover text-center table-condensed">-->
                                <tbody>
                                <tr ng-click="historyjobdetail.HideMsg($index)" style="cursor: pointer">
                                    <td >{{item.extended.name}}</td>
                                    <td >{{item.extended.approver}}</td>
                                    <td >{{item.starttime}}</td>
                                    <td >{{item.finishtime}}</td>
                                    <td >{{historyjobdetail.seftime(item.starttime,item.finishtime)}}</td>
                                    <td ng-style="setStatuColor(item.status, 'scp')">{{historyjobdetail.statuszh[item.status]}}</td>
                                    <td ng-if="item.status == 'success'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='decision'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.Runnigs($index, item)">重试</button>
                                        <button class="btn btn-danger btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runIgnore($index, item)">忽略错误</button>
                                        <button class="btn btn-dark btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runShutTask($index, item)">终止任务</button>
                                    </td>
                                    <td ng-if="item.status=='fail'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="$index != historyjobdetail.tasklength  && status != 'fail'" class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">下一步</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='ignore'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                        <button ng-if="item.pause" class="btn btn-success btn-sm" ng-click="historyjobdetail.runConfirm($index, item,item.pause)">执行确认</button>
                                    </td>
                                    <td ng-if="item.status=='running'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                    </td>

                                    <td ng-if="item.status=='refuse'">
                                        <button class="btn btn-warning btn-sm" onclick="event.cancelBubble=true" ng-click="historyjobdetail.runDetail($index)">执行详情</button>
                                    </td>
                                    <td ng-if="!item.status"> </td>
                                </tr>
                                </tbody>
                            </table>
                            <div ng-if="historyjobdetail.show[$index]" style="border-top: 1px solid #ddd;">
                                <div class="form-horizontal">
                                    <form class="form-inline" name="searchForm" novalidate>
                                        <div class="container-fluid">
                                            <div class="row" style="padding: 5px;margin-left: 1%;">
                                                <div class="form-group col-sm-6" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">审批内容:</label>
                                                    <span style="font-size: 15px">{{item.extended.cont}}</span>
                                                </div>
                                                <div class="form-group col-sm-3" style="padding: 0">
                                                    <label style="line-height: 34px;min-width: 90px;text-align: right;">pause:</label>
                                                    <span style="font-size: 15px">{{item.extended.pause}}</span>
                                                </div>
                                            </div>
                                        </div>
                                    </form>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>


                <div ng-if="item.jobtype" class="panel panel-primary">
                    <div class="panel-heading" style="height: 33px">
                        <h5>作业日志</h5>
                    </div>

                    <job-subtask-log-area jobuuid="jobuuid" loguuid="loguuid" jobaddr="salve"  class="fluid-width"></job-subtask-log-area>

                </div>
            </div>

        </div>
    </div>

</div>
